home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / plcont.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  1KB  |  37 lines

  1. /* Draws a contour plot from data in z(nx,ny), using the subarray */
  2. /* from kx to lx in the x direction and from ky to ly in the y */
  3. /* direction. The array of contour levels is clevel(nlevel), and */
  4. /* "tr" is the name of a subroutine which transforms array indicies */
  5. /* into world coordinates */
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include "plplot.h"
  10. #include "declare.h"
  11.  
  12. void plcont(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,tr)
  13. int nx, ny, kx, lx, ky, ly, nlevel;
  14. float *z, clevel[];
  15. void (*tr)();
  16. {
  17.       int i, mx, my, nstor;
  18.  
  19.       mx = lx - kx + 1;
  20.       my = ly - ky + 1;
  21.  
  22.       if (kx < 1 || lx > nx || kx >= lx || ky < 1 || ky > ny || ky >= ly)
  23.                fatal("Argument error in PLCONT");
  24.       
  25.       nstor = mx*my/5;
  26.  
  27.       if( heapc != NULL)
  28.          free(heapc);
  29.       if(( heapc = (int *)malloc((mx+2*nstor)*sizeof(int))) == NULL)
  30.          fatal("Not enough heap space in PLCONT.");
  31.  
  32.       for (i=0; i<nlevel; i++)
  33.         plcntr(z,nx,ny,kx,lx,ky,ly,clevel[i],&heapc[0],
  34.                &heapc[nx],&heapc[nx+nstor],nstor,tr);
  35.  
  36. }
  37.